package com.myzl.common.enums;

import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author cew
 * @date 2023年9月18日16:03:42
 */
@Getter
public enum LedScreenContent {

    /** 0 标题 */
    TITLE(0, "明月智联非接触式皮带秤","吨/小时"),
    /** 1 瞬时量 */
    CURRENT(1, "瞬时量","吨/小时"),
    /** 2 当前带速 */
    SPEED(2, "当前带速","米/秒"),
    /** 3 早班 */
    MORNING(3, "早班","吨"),
    /** 4 中班 */
    NOON(4, "中班","吨"),
    /** 5 晚班 */
    NIGHT(5, "晚班","吨"),
    /** 6 本日" */
    DAY(6, "本日","吨"),
    /** 7 本月 */
    MONTH(7, "本月","吨"),
    /** 8 本年 */
    YEAR(8, "本年","吨"),
    /** 9 全部 */
    ALL(9, "全部","吨");

    private LedScreenContent(Integer code, String info,String unit){
        this.code = code;
        this.info = info;
        this.unit = unit;
    }

    public static String getTextInfo(String info,String data,String unit){
        return info + ": " + data + " " + unit;
    }

    public static LedScreenContent toType(Integer code) {
        return Stream.of(LedScreenContent.values()).filter(p -> p.code.equals(code)).findAny().orElse(null);
    }

    private final Integer code;
    private final String info;
    private final String unit;
}
